{% comment %}
Copyright 2010 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}

{% load i18n %}

<div class="view note">
  <div class="source">
  {% trans "Posted by" %}
  {% if note.author_name %}
    <span class="author">{{note.author_name}}</span>
  {% else %}
    <span class="author unknown">{% trans "(unknown)" %}</span>
  {% endif %}
  {% trans "on" %}
  <span class="date">{{note.source_date_local|date:"Y-m-d"}}</span>
  {% trans "at" %}
  <span class="time">{{note.source_date_local|date:"H:i"}}</span>
  {{config.time_zone_abbreviation|default:"UTC"}}
  {% if not flag_note_page %}
  {% if note.hidden %}
    <div class="hidden-note">
      {% trans "This note has been marked as spam." %}
      <a href="#" id="reveal-note" style="display: inline;"
        onclick="hide_unhide_note_contents('{{note.record_id}}'); return false;">
        {% trans "Reveal note" %}</a>
      <a href="#" id="hide-note" style="display: none;"
        onclick="hide_unhide_note_contents('{{note.record_id}}'); return false;">
        {% trans "Hide note" %}</a>
      <a href="{{note.flag_spam_url}}" id="{{note.record_id}}-mark-not-spam"
        style="display: none;">
        {% trans "Not spam" %}</a>
    </div>
  {% else %}
    <span class="report-spam">
    <a href="{{note.flag_spam_url}}">
      {% trans "Report spam" %}</a></span>
  {% endif %}
  {% endif %}
  {% if note.author_email %}
    <div class="contact">
      {% trans "E-mail" %}:
      {% if show_private_info %}
        {{note.author_email|escape}}
      {% else %}
        <a href="{{reveal_url}}">
          {% trans "(click to reveal)" %}</a>
      {% endif %}
    </div>
  {% endif %}
  {% if note.author_phone %}
    <div class="contact">
      {% trans "Phone" %}:
      {% if show_private_info %}
        {{note.author_phone}}
      {% else %}
        <a href="{{reveal_url}}">
          {% trans "(click to reveal)" %}</a>
      {% endif %}
    </div>
  {% endif %}
</div>

<div class="contents" id="{{note.record_id}}-contents"
  {% if note.hidden and not flag_note_page %}style="display: none;"{% endif %}>
  <span name="note_text"><span>{{note.text.strip|linebreaksbr}}</span></span>
  {% if note.linked_person_record_id or note.status or note.found or note.last_known_location or note.email_of_found_person or note.phone_of_found_person %}
    <p>
  {% endif %}

  {% if note.linked_person_record_id %}
    <div class="field">
      {% trans "This record is a duplicate of" %}
      <a href="{{note.linked_person_url}}"
        >{{note.linked_person_record_id}}</a>
    </div>
  {% endif %}
  {% if note.status %}
    <div class="status">
      <span class="label">
        {% trans "Status" %}:
      </span>
      <span class="field {{note.status}}">
        {{note.status_text}}
      </span>
    </div>
  {% endif %}
  {% if note.found %}
    <div class="field">
      {% trans "This person has been in contact with someone" %}
    </div>
  {% endif %}
  {% if note.email_of_found_person %}
    <div>
      <span class="label">
        {% trans "Missing person's current e-mail address" %}:
      </span>
      <span class="field">
        {% if show_private_info %}
          {{note.email_of_found_person}}
        {% else %}
          <a href="{{reveal_url}}">
            {% trans "(click to reveal)" %}</a>
        {% endif %}
      </span>
    </div>
  {% endif %}
  {% if note.phone_of_found_person %}
  <div>
    <span class="label">
      {% trans "Missing person's current phone number" %}:
    </span>
    <span class="field">
      {% if show_private_info %}
        {{note.phone_of_found_person}}
      {% else %}
        <a href="{{reveal_url}}">
          {% trans "(click to reveal)" %}</a>
      {% endif %}
    </span>
  </div>
{% endif %}
{% if note.last_known_location %}
  <div>
    <span class="label">
      {% trans "Last known location" %}:
    </span>
    <span class="field">
      {{note.last_known_location}}
    </span>
  </div>
  {% if env.maps_api_key %}
    <div>
      <div id="map_{{note.record_id}}_show_link" class="hidden">
        <a href='#' onclick="toggle('map_{{note.record_id}}', document.getElementById('map_{{note.record_id}}_real_lat_long').value); return false;" >
          {% trans "Show Map" %}
        </a>
      </div>
    <div id="map_{{note.record_id}}_hide_link" class="hidden">
      <a href='#' onclick="toggle('map_{{note.record_id}}', document.getElementById('map_{{note.record_id}}_real_lat_long').value); return false;" >
        {% trans "Hide Map" %}
      </a>
    </div>
    <input type="hidden" id="map_{{note.record_id}}_real_lat_long" value="{{note.last_known_location}}"/>
    <script type="text/javascript">
      MaybeToggleMapLink(
        'map_{{note.record_id}}',
        '{{note.last_known_location}}');
    </script>
    <div id="map_{{note.record_id}}" class="hidden map">
    </div>
  </div>
{% endif %}
{% endif %}
<div class="tracking">
  ID: {{note.record_id}}
</div>
</div>
</div>
